package xyz.xtt.exchange.constants;

import java.util.concurrent.TimeUnit;

import xyz.xtt.common.starter.lock.LockConfig;

/**
 * 缓存类枚举
 *
 * @author huqibo
 * @date 2024/11/28
 */
public enum ExchangeLock implements LockConfig {
	/**
	 * 铸造加锁
	 */
	MINT("mint", 1, TimeUnit.MINUTES),

	/**
	 * 铸造加锁
	 */
	MINT_EX("mintEX", 1, TimeUnit.MINUTES),;

	/**
	 * 缓存key前缀
	 */
	private String prefix;
	/**
	 * 缓存时长
	 */
	private long ttl;
	/**
	 * 缓存时长单位
	 */
	private TimeUnit timeUnit;

	private <T> ExchangeLock(String prefix, long ttl, TimeUnit timeUnit) {
		this.prefix = prefix;
		this.ttl = ttl;
		this.timeUnit = timeUnit;
	}

	@Override
	public String prefix() {
		return prefix;
	}

	@Override
	public long ttl() {
		return ttl;
	}

	@Override
	public TimeUnit timeUnit() {
		return timeUnit;
	}

}
